<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        <ul></ul>
    </div>
    <script>
    // 1创建节点元素节点
    let li = document.createElement('li');
    // 2添加节点node.appendChild(child)node是父级 child字节后面追加元素与数组中的push相似
    let ul = document.querySelector('ul');
    ul.appendChild(li)
    //3添加节点node.insertBefore(child,指定元素)
    let l = document.createElement('li');
    ul.insertBefore(l,ul.children[0])
        //4 想要页面添加一个新元素1.创建元素 2 添加元素
    </script>
</body>
</html>